﻿using System;
using System.Collections.Generic;
using DevExpress.Entity.Model;
using System.Collections.Generic;

namespace EduFormManager.Models
{
        public class Municipality : Entity, IComparable
        {
            private ISet<EduOrg> eduorgs = new HashSet<EduOrg>();
            public virtual string Name { get; set; }
            public virtual string Operator { get; set; }
            public virtual string Comment { get; set; }
            public virtual ISet<EduOrg> EduOrgs
            {
                get { return eduorgs; }
                set { eduorgs = value; }
            }
            public virtual ISet<MunicipalityFormData> FormData
            {
                get;
                set;
            }

            public override string ToString()
            {
                return this.Name;
            }

            public override bool Equals(object obj)
            {
                if (obj is Municipality)
                {
                    Municipality mObj = obj as Municipality;
                    return mObj.Id == this.Id;
                }
                return false;
            }

            public virtual int CompareTo(object obj)
            {
                if (obj is Municipality)
                    return this.Id.CompareTo(((Municipality) obj).Id);
                return -1;
            }
        }

}
